$(document).ready(function() {
    // when a user click on a link of this class, the item parent of the link
    // get moved to the list of available games (and, thanks to AJAX, the game
    // it refers to get deleted of his favorites)
    $(".del-fav-link").live("click", function() {
        var new_a = $('<a href="javascript:void(0)">Add</a>');
        new_a.addClass('add-fav-link');
        new_a.appendTo($(this).parent());
        $(this).parent().appendTo("#games ul");
        $(this).remove();
    });
    
    // when a user click on a link of this class, the item parent of the link
    // get moved to the favorites list (and, thanks to AJAX, the game get added
    // to his favorites)
    $(".add-fav-link").live("click", function() {
        var new_a = $('<a href="javascript:void(0)">Delete</a>');
        new_a.addClass('del-fav-link');
        new_a.appendTo($(this).parent());
        $(this).parent().appendTo("#favorites ul");
        $(this).remove();
    });
});